package vn.fpt.snake.entity;

import java.awt.Image;

public abstract class AbstractFruit {
	private int x;
	private int y;
	Image icon;
	int score;
	int dot;
	boolean isDie;
	
	public int getDot() {
		return dot;
	}

	public void setDot(int dot) {
		this.dot = dot;
	}

	public boolean isDie() {
		return isDie;
	}

	public void setDie(boolean isDie) {
		this.isDie = isDie;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getX() {
		return x;
	}
	
	public void setX(int x) {
		this.x = x;
	}
	
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	
	public Image getIcon() {
		return icon;
	}

	public void setIcon(Image icon) {
		this.icon = icon;
	}

	public boolean checkLocateWithSnake(Snake snake) {
		int dots = snake.getDots();
		for(int i = 0; i < dots; i++){
			if (this.getX() == snake.getX(i)|| this.getY() == snake.getY(i)) {
				return false;
			}
		}
		
		return true;
	} 
}
